<template>
  <view class="page">
    <view class="top">
      <view class="status-bar"></view>
    </view>
    <view class="card">
      <up-swiper
        :list="swiperList"
        keyName="image"
        :autoplay="false"
        circular
        indicator
        indicatorMode="dot"></up-swiper>
      <view class="swiperBox"></view>
    </view>
    <view class="cardmiddle">
      <view class="sub-title">-- 服务全球中小企业 --</view>
    </view>
    <view class="gangzhong1">
      <view class="box">
        <view class="title">港中联</view>
        <view class="more">了解详情</view>
      </view>
      <view class="box">
        <view class="title">港中盈</view>
        <view class="more">了解详情</view>
      </view>
    </view>
    <view class="zhongying">港中盈 -- 优质的服务项目</view>
    <view class="migrate">
      <view class="list">
        <view style="width: 70%">
          <view class="title">香港移民</view>
          <view class="smalltitle">
            这里加上一个简述这里加上一个简述这里加上一个简述,后台可以设置
          </view>
        </view>
        <image
          class="img"
          src="https://oss.bigchun.com/img/tupian/m1.png"
          alt=""
          mode="widthFix" />
      </view>
      <view class="list">
        <view style="width: 70%">
          <view class="title">香港留学</view>
          <view class="smalltitle">
            这里加上一个简述这里加上一个简述这里加上一个简述,后台可以设置
          </view>
        </view>
        <image
          class="img"
          src="https://oss.bigchun.com/img/tupian/m2.png"
          alt=""
          mode="widthFix" />
      </view>
      <view class="list">
        <view style="width: 70%">
          <view class="title">企业补贴</view>
          <view class="smalltitle">
            这里加上一个简述这里加上一个简述这里加上一个简述,后台可以设置
          </view>
        </view>
        <image
          class="img"
          src="https://oss.bigchun.com/img/tupian/m3.png"
          alt=""
          mode="widthFix" />
      </view>
      <view class="list">
        <view style="width: 70%">
          <view class="title">代办公司</view>
          <view class="smalltitle">
            这里加上一个简述这里加上一个简述这里加上一个简述,后台可以设置
          </view>
        </view>
        <image
          class="img"
          src="https://oss.bigchun.com/img/tupian/m4.png"
          alt=""
          mode="widthFix" />
      </view>
      <view class="list">
        <view style="width: 70%">
          <view class="title">香港移民</view>
          <view class="smalltitle">
            这里加上一个简述这里加上一个简述这里加上一个简述,后台可以设置
          </view>
        </view>
        <image
          class="img"
          src="https://oss.bigchun.com/img/tupian/m5.png"
          alt=""
          mode="widthFix" />
      </view>
    </view>
    <liuDragButton @clickBtn="clickBtn">
      <image
        src="https://oss.bigchun.com/img/tupian/kefu.png"
        mode=""
        style="width: 180rpx; height: 80rpx" />
    </liuDragButton>
  </view>
</template>

<script setup>
const lineBg =
  "";
import { ref, getCurrentInstance, reactive } from "vue";
import liuDragButton from "@/components/liu-drag-button/liu-drag-button.vue";
const { proxy } = getCurrentInstance();
const tab = ref(1);
const tab2 = ref(0);
const params = ref({
  page: 1,
  per_page: 10,
});
const tab2list = ref([]);
const DataList = ref([]);
const swiperList = reactive([
  {
    image: "https://cdn.uviewui.com/uview/swiper/swiper2.png",
    title: "昨夜星辰昨夜风，画楼西畔桂堂东",
  },
  {
    image: "https://cdn.uviewui.com/uview/swiper/swiper1.png",
    title: "身无彩凤双飞翼，心有灵犀一点通",
  },
  {
    image: "https://cdn.uviewui.com/uview/swiper/swiper3.png",
    title: "谁念西风独自凉，萧萧黄叶闭疏窗，沉思往事立残阳",
  },
]);
function tabHandle(i) {
  tab.value = i;
}

function getTabData() {
  proxy
    .$request({
      url: "api/consult/consultSort",
      header: "application/x-www-form-urlencoded",
      data: {},
    })
    .then((res) => {
      if (res.code == 0) {
        return proxy.$toast(res.msg);
      } else {
        tab2list.value = res.data.list.slice(0, 4);
        tab2.value = tab2list.value[0].id;
        getListData();
      }
    });
}
getTabData();

function getListData() {
  proxy
    .$request({
      url: "api/consult/consultManage",
      header: "application/x-www-form-urlencoded",
      data: {
        consult_sort_id: tab2.value,
        page: params.value.page,
        per_page: params.value.per_page,
      },
    })
    .then((res) => {
      if (res.code == 0) {
        return proxy.$toast(res.msg);
      } else {
        DataList.value = res.data.list;
      }
    });
}
const art1 = ref({});
const art2 = ref({});

function getSingleData() {
  proxy
    .$request({
      url: "api/consult/single",
      header: "application/x-www-form-urlencoded",
      data: {
        // 1用户协议,2隐私协议3商会介绍4会员介绍
        type_id: 3,
      },
    })
    .then((res) => {
      if (res.code == 0) {
        return proxy.$toast(res.msg);
      } else {
        art1.value = res.data.details;
      }
    });
  proxy
    .$request({
      url: "api/consult/single",
      header: "application/x-www-form-urlencoded",
      data: {
        // 1用户协议,2隐私协议3商会介绍4会员介绍
        type_id: 4,
      },
    })
    .then((res) => {
      if (res.code == 0) {
        return proxy.$toast(res.msg);
      } else {
        art2.value = res.data.details;
      }
    });
}
getSingleData();

function tabHandle2(i) {
  tab2.value = i.id;
  getListData();
}
// 打开客服会话
function contactFn(e) {
  console.log("e: ", e);
}
function contactfn2(e) {
  // 1 跳转到微信公众号的小程序页面 需要微信公众号AppId和路径
  uni.navigateToMiniProgram({
    appId: "wx02cd9b212cf0a1fc", // 公众号的appid
    path: "pages/index/index", // 打开的页面路径，这里假设是公众号的首页
    extraData: {}, // 需要传递给目标小程序的数据
    success(res) {
      // 打开成功的回调
      console.log("打开成功");
    },
    fail(err) {
      // 打开失败的回调
      console.error("打开失败", err);
    },
  });
  // 2.在微信公众号使用h5页面 跳转到该页面
  uni.navigateTo({
    url: "https://公众号H5Url",
    success() {
      console.log("跳转成功");
    },
    fail() {
      console.log("跳转失败");
    },
  });
}

function handleApply() {
  uni.navigateTo({
    url: "/pages/apply/applyOne",
  });
}
</script>

<style lang="scss" scoped>
.page {
  background: #f8f8f8;
}

.r-icon {
  width: 24rpx;
  height: 24rpx;
}

.top {
  width: 750rpx;
  height: 330rpx;
  background: url("https://oss.bigchun.com/img/index-bg2.png") 0 0 no-repeat;
  // background: url(https://oss.bigchun.com/img/gangzhongying/index-bg1.png) 0 0 no-repeat;
  background-size: 100% 100%;
}
.cardmiddle {
  width: 686rpx;
  height: 186rpx;
  background: url("../../static/img/index/index-g1.png") 0 0 no-repeat;
  background-size: 100% 100%;
  padding-top: 114rpx;
  box-sizing: border-box;
  margin: 0 auto;
  .sub-title {
    font-weight: 500;
    font-size: 28rpx;
    color: #333333;
    line-height: 33rpx;
    text-align: center;
    margin-bottom: 18rpx;
  }
  .card-btns {
    padding: 0 16rpx;
  }
  .card-btn {
    margin: 0 auto;
    width: 298rpx;
    height: 96rpx;
    background: linear-gradient(128deg, #ff963b 0%, #ff7d43 100%);
    border-radius: 48rpx;

    .icon1 {
      width: 36rpx;
      height: 36rpx;
      margin-right: 6rpx;
    }

    .text {
      height: 44rpx;
      font-family: PingFang SC, PingFang SC;
      font-weight: 500;
      font-size: 32rpx;
      color: #ffffff;
      line-height: 38rpx;
      text-align: center;
      font-style: normal;
      text-transform: none;
    }
  }
}
.card {
  margin-left: 27rpx;
  margin-top: -146rpx;
  width: 686rpx;
  height: 300rpx;
  // background: url(https://oss.bigchun.com/img/gangzhongying/index-g1.png) 0 0
  //   no-repeat;
  // background-size: 100% 100%;
  // padding-top: 94rpx;
  box-sizing: border-box;
}
.gangzhong1 {
  display: flex;
  width: 686rpx;
  margin-left: 27rpx;
  margin-top: 20rpx;

  .box {
    flex: 1;
    height: 246rpx;

    background: url("https://oss.bigchun.com/img/tupian/image1.png") 0 0
      no-repeat;
    background-size: 100% 100%;
    border-radius: 20rpx;
    text-align: center;
    .title {
      font-family: PingFang SC, PingFang SC;
      font-weight: 500;
      font-size: 40rpx;
      color: #02109c;
      line-height: 47rpx;
      margin-top: 48rpx;
    }
    .more {
      width: 162rpx;
      height: 54rpx;
      background: #ffffff;
      border-radius: 74rpx 74rpx 74rpx 74rpx;
      font-weight: 500;
      font-size: 24rpx;
      color: #02109c;
      line-height: 54rpx;
      margin: 30rpx auto 0;
    }
  }
  .box:nth-child(1) {
    margin-right: 26rpx;
  }
  .box:nth-child(2) {
    background: url("https://oss.bigchun.com/img/tupian/image2.png") 0 0
      no-repeat;
  }
}
.zhongying {
  font-weight: bold;
  font-size: 36rpx;
  color: #08124d;
  line-height: 42rpx;
  margin-left: 27rpx;
  margin-top: 30rpx;
  margin-bottom: 30rpx;
}
.migrate {
  width: 686rpx;
  margin: 0 auto;
  padding-bottom: 50rpx;
  .list {
    width: 100%;
    height: 144rpx;
    background: #fff7ec;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
    padding: 28rpx 30rpx;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    .title {
      font-weight: 500;
      font-size: 32rpx;
      color: #08124d;
    }
    .smalltitle {
      font-weight: 400;
      font-size: 24rpx;
      color: #08124d;
      margin-top: 20rpx;
      width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .img {
      width: 144rpx;
      margin-top: -30rpx;
    }
  }
  .list:nth-child(2) {
    background: #e5f4f4;
  }
  .list:nth-child(3) {
    background: #ffecd6;
  }
  .list:nth-child(4) {
    background: #d3eaff;
  }
  .list:nth-child(5) {
    background: #e4e6ff;
  }
}
.tabs {
  border-radius: 8rpx;
  margin: 0 33rpx;
  overflow: hidden;

  .tab-i {
    width: 342rpx;
    height: 88rpx;
    background: #ffffff;
    color: #666666;
  }

  .tab-active {
    background: #ff8538;
    color: #ffffff;
  }

  .icon1 {
    width: 36rpx;
    height: 36rpx;
    margin-right: 4rpx;
  }

  .text {
    font-weight: 500;
    font-size: 28rpx;
    line-height: 33rpx;
    text-align: center;
  }
}

.list {
  padding: 38rpx 0;
  margin-top: 24rpx;
  border-radius: 20rpx 20rpx 0 0;
  width: 750rpx;
  background: #ffffff;

  .tabs2 {
    .tab2item {
      flex: 1;
      text-align: center;
      font-weight: 400;
      font-size: 28rpx;
      height: 40rpx;
      color: #333333;
      line-height: 33rpx;
    }

    .tab2-active {
      font-weight: bold;
      background: url(https://oss.bigchun.com/img/gangzhongying/index-i4.png)
        32rpx 30rpx no-repeat;
      background-size: 82rpx 28rpx;
    }
  }

  .t-box {
    overflow: hidden;
    margin-bottom: 12rpx;

    .r {
      // margin-top: -4rpx;
      margin-left: 0rpx;
      margin-right: 4rpx;

      .text {
        font-weight: 400;
        font-size: 24rpx;
        color: #999999;
        line-height: 28rpx;
        margin-right: 4rpx;
      }
    }
  }

  .list-box {
    padding: 20rpx 32rpx;

    .item {
      width: 330rpx;
      margin-bottom: 30rpx;

      .img {
        width: 330rpx;
        height: 440rpx;
        border-radius: 8rpx 8rpx 8rpx 8rpx;
      }

      .tit {
        margin-top: 20rpx;
        font-weight: 500;
        font-size: 28rpx;
        color: #333333;
        line-height: 48rpx;
      }
    }
  }
}

.article {
  margin-top: 18rpx;
  background: #ffffff;
  padding: 50rpx 32rpx;

  .box {
    .box-tit {
      margin: 8rpx 0;

      .icon {
        width: 32rpx;
        height: 32rpx;
        margin-right: 16rpx;
      }

      .tit {
        font-weight: 800;
        font-size: 32rpx;
        color: #333333;
        line-height: 44rpx;
        width: 184rpx;
        height: 84rpx;
        background: url(https://oss.bigchun.com/img/gangzhongying/index-i-bg.png)
          74rpx 0rpx no-repeat;
        background-size: 124rpx 84rpx;
      }
    }

    .content {
      padding: 10rpx 0;
      font-weight: 400;
      font-size: 28rpx;
      color: #000000;
      line-height: 44rpx;
      text-align: left;
    }

    .content2 {
      padding-top: 48rpx;

      .btn {
        width: 686rpx;
        height: 108rpx;
        background: #1f2967;
        border-radius: 54rpx 54rpx 54rpx 54rpx;
        font-weight: 500;
        font-size: 32rpx;
        color: #ffffff;
        line-height: 44rpx;
      }
    }
  }
}
</style>
